package com.blog.effective.note8;

import java.awt.*;

/**
 * 〈测试有关equals方法传递性的类〉<br>
 *
 * @author 未绪
 * @time 2017/12/17 11:54
 */
public class PointDemo {

    public static void main(String[] args) {

        Point p1=new Point(10,20);
        Point p2=new Point(10,20);

        System.out.println(p1.equals(p2));      // 输出 true

        ColorPoint cp1=new ColorPoint(1,1, Color.BLUE);
        Point p=new Point(1,1);
        ColorPoint cp2=new ColorPoint(1,1, Color.RED);

        System.out.println(cp1.equals(p));      //true
        System.out.println(p.equals(cp2));      //true
        System.out.println(cp2.equals(p));      //true
        System.out.println(cp1.equals(cp2));    //false

    }

}
